import random

sticks = 21
print('there ate 21 sticks,you can take 1-4 sticks.')
print('if you don\'t take last one stick ,you will win.')

is_win = True

while True:
    if sticks == 1:
        is_win = False
        break
    user_sticks = int(input('get 1 to 4 sticks: '))
    if user_sticks <= 0 or user_sticks > 4:
        print('wrong input!')
        continue
    if user_sticks >= sticks:
        is_win = False
        break
    sticks -= user_sticks
    computer_take = random.randint(1, 5)
    if computer_take >= sticks:
        is_win = True
        break
    print("you take: %s ,computer take: %s." % (user_sticks, computer_take))
    sticks -= computer_take
    print('left sticks: %s.' % (sticks))

if is_win:
    print('you are winner!')
else:
    print('you do not win.')
